]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceAnimation: Get time outside of the animation-complete callback
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 7 Mar 2022 14:34:25 +0000 (15:34 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sun, 13 Mar 2022 00:06:03 +0000 (00:06 +0000)
We want to use the current event time for activating the workspace, and
this time is only available when calling global.get_current_time() or
Clutter.get_current_event_time() from the context of an event handler.

So instead of trying to get that time when the animation has finished
from the onComplete() handler, get it before and store it as a variable
to use in the onComplete() handler later.

This fixes an error message when switching workspaces using the swipe
gesture where MetaWorkspace complains about the 0-timestamp we pass it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2233>

js/ui/workspaceAnimation.js

index b807f35778343fb918a1f97df611127ac5f0e679..432044f7592b84099c7fb1c44ca33489b048f20c 100644 (file)
@@ -450,6 +450,7 @@ var WorkspaceAnimationController = class {
         switchData.gestureActivated = true;
 
         const newWs = switchData.baseMonitorGroup.findClosestWorkspace(endProgress);
+        const endTime = Clutter.get_current_event_time();
 
         for (const monitorGroup of this._switchData.monitors) {
             const progress = monitorGroup.getWorkspaceProgress(newWs);
@@ -462,7 +463,7 @@ var WorkspaceAnimationController = class {
             if (monitorGroup.index === Main.layoutManager.primaryIndex) {
                 params.onComplete = () => {
                     if (!newWs.active)
-                        newWs.activate(global.get_current_time());
+                        newWs.activate(endTime);
                     this._finishWorkspaceSwitch(switchData);
                 };
             }